<script type="text/javascript">
    function register_validate()
    {
        var fullname    = document.getElementById("fullname").value;
        var email       = document.getElementById("email").value;
        var password    = document.getElementById("password").value;
        var rePassword  = document.getElementById("rePassword").value;
        
        if(fullname == '')
        {
            document.getElementById("error").innerHTML="Bạn chưa điền đầy đủ thông tin";
            return false;
        }
        else if(fullname.length > 50)
        {
            document.getElementById("error").innerHTML="Tên đầy đủ tối đa 50 kí tự";
            return false;
        }
        else
        {
            var reg = /[a-zA-ZÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚĂĐĨŨƠàáâãèéêìíòóôõùúăđĩũơƯĂẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼỀỀỂưăạảấầẩẫậắằẳẵặẹẻẽềềểỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪễệỉịọỏốồổỗộớờởỡợụủứừỬỮỰỲỴÝỶỸửữựỳỵỷỹ ]+[^ ]+$/;
            if(reg.test(fullname) == false)
            {
                document.getElementById("error").innerHTML="Tên đầy đủ không hợp lệ";
                return false;
            }
        }
        if(email == '')
        {
            document.getElementById("error").innerHTML="Bạn chưa điền đầy đủ thông tin";
            return false;
        }
        else if(email.length > 100)
        {
            document.getElementById("error").innerHTML="Email tối đa 100 kí tự";
            return false;
        }
        else
        {
            var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
            if(reg.test(email) == false)
            {
                document.getElementById("error").innerHTML="Địa chỉ email không hợp lệ";
                return false;
            }
        }
        if(password == '')
        {
            document.getElementById("error").innerHTML="Bạn chưa điền đầy đủ thông tin";
            return false;
        }
        else
        {
            if((password.length < 6) || (password.length > 32))
            {
                document.getElementById("error").innerHTML="Mật khẩu độ dài 6-32 kí tự";
                return false;
            }
        }
        if(rePassword == '')
        {
            document.getElementById("error").innerHTML="Bạn chưa điền đầy đủ thông tin";
            return false;
        }
        else
        {
            if((rePassword.length < 6) || (rePassword.length > 32))
            {
                document.getElementById("error").innerHTML="Mật khẩu độ dài 6-32 kí tự";
                return false;
            }
        }
        if(password != rePassword)
        {
            document.getElementById("error").innerHTML="Mật khẩu không trùng khớp";
            return false;
        }
    }
</script>
<!--Begin All-->
    <!--Begin Contents-->
    <div class="d_contents_wrap_2">
    	<div class="d_space_height_10"></div>
		
        <!-- Left -->
        <div class="dd_ctsp">
        <!-- Kênh tin-->
            <div class="ttct_top">
                <div class="pl20" style="margin-left: 200px;"><h3>Đăng ký</h3></div>
            </div>
            
            <div class="dd_ctsp_mid">
                <div class="pa20">
            	<div class="user_form">
                    <form action="" method="post" >
                    <table class="register_table" cellspacing="5" style="margin-left: 20px;">
                        <tr>
                            <td><?php echo $this->formLabel('fullname', 'Tên đầy đủ:', array('class' => 'label'));  ?></td>
                            <td><?php echo $this->formText('fullname', $this->fullnameValue, array('id' => 'fullname', 'class' => 'input','style'=>'width:250px'));?><?php echo '<font color="red"> '.$this->errorFullname.'</font>';?></td>
                        </tr>
                        <tr>
                            <td><?php echo $this->formLabel('email', 'Email:', array('class' => 'label')); ?></td>
                            <td><?php echo $this->formText('email', $this->emailValue, array('id' => 'email', 'class' => 'input','style'=>'width:250px'));  ?> <?php echo '<font color="red"> '.$this->errorEmail.'</font>';?></td>
                        </tr>
                        <tr>
                            <td><?php echo $this->formLabel('password', 'Mật khẩu:', array('class' => 'label')); ?></td>
                            <td><?php echo $this->formPassword('password', null, array('id' => 'password', 'class' => 'input','style'=>'width:250px')); ?><?php echo '<font color="red"> '.$this->errorPassword.'</font>';?></td>
                        </tr>
                        <tr>
                            <td><?php echo $this->formLabel('rePassword', 'Nhập lại mật khẩu:', array('class' => 'label')); ?></td>
                            <td><?php echo $this->formPassword('rePassword', null, array('id' => 'rePassword', 'class' => 'input','style'=>'width:250px')); ?><?php echo '<font color="red"> '.$this->errorRepassword.'</font>';?></td>
                        </tr>
                        <tr>
                            <td><?php echo $this->formLabel('gender', 'Giới tính:', array('class' => 'label')); ?></td>
                            <td><?php echo $this->formSelect('gender', $this->genderValue, 
                                array('id' => 'gender', 'class' => 'input','style'=>'width:80px'),
                                array('1' => 'Nam', '2' => 'Nữ')); ?>
                            </td>
                                                       
                        </tr>
                        <tr >   
                                <td><?php echo $this->formLabel('captchar', '', array('class' => 'label')); ?></td>
                                <td><?php echo $this->captcha; echo $this->formButton('thu','Thử lại');?></td> 
                        </tr>
                        <tr>
                                <td><?php echo $this->formLabel('captcha', 'Nhập chuỗi:', array('class' => 'label')); ?></td>
                                <td><?php echo $this->formText('captcha', null, array('captcha_id'=> $this->captchaID, 'class' => 'input','style'=>'width:250px'));
                                      echo $this->formHidden('captcha_id',$this->captchaID);echo '<font color="red"> '.$this->errorCaptcha.'</font>';?></td>
                                
                        </tr>  
                                
                        <tr>
                         <td><?php echo $this->formLabel('captchar', '', array('class' => 'label')); ?></td>
                        </tr>
                        <tr >                            
                            <td>&nbsp;</td>                            
                            <td style="margin-left: 100px;float: left;"><?php echo "<br>".$this->formSubmit('submit', 'Đăng ký', array('class' => 'button')); ?></td>
                        </tr>
                    </table>
                    </form>
                    
                    
                </div>
                
                <div class="msg_register">
                    <span class="msg" id="error"></span>
                </div>
                </div>
            </div>
            <div class="dd_ctsp_bot"></div>
        <!-- End Kenh Tin -->

        </div>
        <!-- End Left -->  